<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
    />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <link rel="stylesheet" href="/umi.css" />
    <script>
      window.routerBase = "/";
    </script>
    <script>
      //! umi version: 3.3.7
    </script>
    <title>FAQ</title>
  </head>
  <body>
    <div id="root"><div class="__dumi-default-layout" data-route="/guide/faq" data-show-sidemenu="true" data-show-slugs="true" data-site-mode="true" data-gapless="false"><div class="__dumi-default-navbar" data-mode="site"><button class="__dumi-default-navbar-toggle"></button><a class="__dumi-default-navbar-logo" style="background-image:url(&#x27;./images/homebrew-256x256.png&#x27;)" href="/">Homebrew</a><nav><div class="__dumi-default-search"><input type="search" class="__dumi-default-search-input" value=""/><ul></ul></div><span><a aria-current="page" class="active" href="/guide">指南</a></span><span><a target="_blank" rel="noopener noreferrer" href="https://github.com/ineo6/homebrew-install">GitHub<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></span></nav></div><div class="__dumi-default-menu" data-mode="site"><div class="__dumi-default-menu-inner"><div class="__dumi-default-menu-header"><a class="__dumi-default-menu-logo" style="background-image:url(&#x27;./images/homebrew-256x256.png&#x27;)" href="/"></a><h1>Homebrew</h1><p></p></div><div class="__dumi-default-menu-mobile-area"><ul class="__dumi-default-menu-nav-list"><li><a aria-current="page" class="active" href="/guide">指南</a></li><li><a target="_blank" rel="noopener noreferrer" href="https://github.com/ineo6/homebrew-install">GitHub<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div><ul class="__dumi-default-menu-list"><li><a target="_blank" rel="noopener noreferrer">介 绍</a><ul><li><a href="/guide"><span>介 绍</span></a></li><li><a href="/guide/how-it-works"><span>如何工作的？</span></a></li><li><a href="/guide/start"><span>快速开始</span></a></li></ul></li><li><a href="/guide/m1">M1芯片 </a></li><li><a aria-current="page" class="active" href="/guide/faq">FAQ</a></li></ul></div></div><ul role="slug-list" class="__dumi-default-layout-toc"><li title="M1芯片Mac如何安装" data-depth="2"><a href="/guide/faq#m1芯片mac如何安装"><span>M1芯片Mac如何安装</span></a></li><li title="fatal: unable to access xxx" data-depth="2"><a href="/guide/faq#fatal-unable-to-access-xxx"><span>fatal: unable to access xxx</span></a></li><li title="设置镜像无效，安装还是很慢" data-depth="2"><a href="/guide/faq#设置镜像无效，安装还是很慢"><span>设置镜像无效，安装还是很慢</span></a></li><li title="command not found: brew" data-depth="2"><a href="/guide/faq#command-not-found-brew"><span>command not found: brew</span></a></li><li title="SHA256 mismatch" data-depth="2"><a href="/guide/faq#sha256-mismatch"><span>SHA256 mismatch</span></a></li><li title="如何判断终端类型" data-depth="2"><a href="/guide/faq#如何判断终端类型"><span>如何判断终端类型</span></a></li></ul><div class="__dumi-default-layout-content"><div class="markdown"><h1 id="faq"><a aria-hidden="true" tabindex="-1" href="/guide/faq#faq"><span class="icon,icon-link"></span></a>FAQ</h1><h2 id="m1芯片mac如何安装"><a aria-hidden="true" tabindex="-1" href="/guide/faq#m1芯片mac如何安装"><span class="icon,icon-link"></span></a>M1芯片Mac如何安装</h2><p><code>Homebrew</code>已支持在<code>arm</code>上安装，但是一些软件兼容性还有待更新，官方查阅地址可看<a target="_blank" rel="noopener noreferrer" href="https://github.com/Homebrew/brew/issues/7857">说明<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>。</p><p>你可以考虑安装<code>x86</code>版本保持兼容性。</p><p>无论安装哪个版本，强烈建议先参考文档：<a href="/guide/m1">M1芯片Mac上Homebrew安装</a>。</p><p>大部分问题都是资源不稳定导致的，如果可以的话尽量通过代理加速。</p><p>代理使用可以参考以下文章：</p><ul><li><a target="_blank" rel="noopener noreferrer" href="http://onwaier.com/?p=229">Mac终端走ssr代理<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li><a target="_blank" rel="noopener noreferrer" href="https://www.xiaodefa.com/digital/121.html">如何让macOS的「终端」走代理？<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul><h2 id="fatal-unable-to-access-xxx"><a aria-hidden="true" tabindex="-1" href="/guide/faq#fatal-unable-to-access-xxx"><span class="icon,icon-link"></span></a>fatal: unable to access xxx</h2><div class="__dumi-default-code-block"><pre class="prism-code language-unknown"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token plain">HEAD is now at 028e733e7 Merge pull request #10260 from reitermarkus/audit-livecheck</span></div><div class="token-line"><span class="token plain"></span></div><div class="token-line"><span class="token plain">fatal: unable to access &#x27;https://github.com/Homebrew/homebrew-core/&#x27;: transfer closed with outstanding read data remaining</span></div><div class="token-line"><span class="token plain">fatal: ambiguous argument &#x27;refs/remotes/origin/master&#x27;: unknown revision or path not in the working tree.</span></div><div class="token-line"><span class="token plain">Use &#x27;--&#x27; to separate paths from revisions, like this:</span></div><div class="token-line"><span class="token plain">&#x27;git &lt;command&gt; [&lt;revision&gt;...] -- [&lt;file&gt;...]&#x27;</span></div><div class="token-line"><span class="token plain"></span></div></pre></div><p>解决方案：</p><ul><li>根据文章[解决GitHub网页githubusercontent地址无法访问问题][hosts]，给<code>github.com</code>域名加速</li><li>通过代理访问</li></ul><h2 id="设置镜像无效，安装还是很慢"><a aria-hidden="true" tabindex="-1" href="/guide/faq#设置镜像无效，安装还是很慢"><span class="icon,icon-link"></span></a>设置镜像无效，安装还是很慢</h2><p>这里说的安装很慢主要是指<code>brew</code>本身安装速度慢（镜像地址没有设置成功）。</p><p>可以执行命令<code>echo $SHELL</code>，先查看终端类型。</p><ul><li>bash: <code>/bin/bash</code></li><li>zsh: <code>/bin/zsh</code></li></ul><p>然后根据终端类型设置镜像，参考&quot;设置镜像&quot;。</p><h2 id="command-not-found-brew"><a aria-hidden="true" tabindex="-1" href="/guide/faq#command-not-found-brew"><span class="icon,icon-link"></span></a>command not found: brew</h2><p>一般是环境变量无效，请使用<code>echo $SHELL</code>确认终端类型，参考上节。</p><p>如果是<code>m1</code>芯片<code>Mac</code>则可能是没有把<code>/opt/homebrew/bin</code>加入环境变量：</p><p>zsh</p><div class="__dumi-default-code-block"><pre class="prism-code language-shell"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token builtin class-name">echo</span><span class="token plain"> </span><span class="token builtin class-name">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant">PATH</span><span class="token operator">=</span><span class="token plain">/opt/homebrew/bin:</span><span class="token environment constant">$PATH</span><span class="token plain"> </span><span class="token operator">&gt;&gt;</span><span class="token plain"> ～/.zprofile </span></div><div class="token-line"><span class="token plain"></span><span class="token builtin class-name">source</span><span class="token plain"> ~/.zprofile</span></div><div class="token-line"><span class="token plain"></span></div></pre></div><p>bash</p><div class="__dumi-default-code-block"><pre class="prism-code language-shell"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token builtin class-name">echo</span><span class="token plain"> </span><span class="token builtin class-name">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant">PATH</span><span class="token operator">=</span><span class="token plain">/opt/homebrew/bin:</span><span class="token environment constant">$PATH</span><span class="token plain"> </span><span class="token operator">&gt;&gt;</span><span class="token plain"> ～/.bash_profile </span></div><div class="token-line"><span class="token plain"></span><span class="token builtin class-name">source</span><span class="token plain"> ~/.bash_profile</span></div><div class="token-line"><span class="token plain"></span></div></pre></div><p>否则可能因为特殊情况需要把<code>/usr/local/bin</code>手动加入环境变量：</p><p>zsh</p><div class="__dumi-default-code-block"><pre class="prism-code language-shell"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token builtin class-name">echo</span><span class="token plain"> </span><span class="token builtin class-name">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant">PATH</span><span class="token operator">=</span><span class="token plain">/usr/local/bin:</span><span class="token environment constant">$PATH</span><span class="token plain"> </span><span class="token operator">&gt;&gt;</span><span class="token plain"> ～/.zprofile </span></div><div class="token-line"><span class="token plain"></span><span class="token builtin class-name">source</span><span class="token plain"> ~/.zprofile</span></div><div class="token-line"><span class="token plain"></span></div></pre></div><p>bash</p><div class="__dumi-default-code-block"><pre class="prism-code language-shell"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token builtin class-name">echo</span><span class="token plain"> </span><span class="token builtin class-name">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant">PATH</span><span class="token operator">=</span><span class="token plain">/usr/local/bin:</span><span class="token environment constant">$PATH</span><span class="token plain"> </span><span class="token operator">&gt;&gt;</span><span class="token plain"> ～/.bash_profile </span></div><div class="token-line"><span class="token plain"></span><span class="token builtin class-name">source</span><span class="token plain"> ~/.bash_profile</span></div><div class="token-line"><span class="token plain"></span></div></pre></div><h2 id="sha256-mismatch"><a aria-hidden="true" tabindex="-1" href="/guide/faq#sha256-mismatch"><span class="icon,icon-link"></span></a>SHA256 mismatch</h2><div class="__dumi-default-code-block"><pre class="prism-code language-unknown"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token plain">Error: An exception occurred within a child process:</span></div><div class="token-line"><span class="token plain">  ChecksumMismatchError: SHA256 mismatch</span></div><div class="token-line"><span class="token plain">Expected: 01059532335fefc5e0e7a23cc79eeb1dc6fea477606981b89f259aa0e0f9abc1</span></div><div class="token-line"><span class="token plain">  Actual: 641ba394c891cee16dfa45873906edab12edfc9befaa121649bb18e7b7d574bf</span></div><div class="token-line"><span class="token plain"> Archive: /Users/XXX/Library/Caches/Homebrew/downloads/1124b500fc261f6d9be6193eca8c120f4dfb7ecd3470ac7d8edc1d04ecc5b345--jdk13u-jdk-13.0.2+8.tar.bz2</span></div><div class="token-line"><span class="token plain">To retry an incomplete download, remove the file above.</span></div><div class="token-line"><span class="token plain"></span></div></pre></div><p>遇到该问题时请尝试该方案：<a target="_blank" rel="noopener noreferrer" href="https://blog.csdn.net/lemostic/article/details/107101219">https://blog.csdn.net/lemostic/article/details/107101219<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p><h2 id="如何判断终端类型"><a aria-hidden="true" tabindex="-1" href="/guide/faq#如何判断终端类型"><span class="icon,icon-link"></span></a>如何判断终端类型</h2><p>在终端执行命令<code>echo $SHELL</code>，根据显示的结果判断：</p><ul><li><code>/bin/bash</code> =&gt; <code>bash</code> =&gt; <code>.bash_profile</code></li><li><code>/bin/zsh</code> =&gt; <code>zsh</code> =&gt; <code>.zprofile</code></li></ul></div><div class="__dumi-default-layout-footer-meta"><span data-updated-text="最后更新时间：">1970-1-1 8:00:00</span></div></div></div></div>
	<script>
  window.g_useSSR = true;
  window.g_initialProps = {};
	</script>

    <script src="/umi.js"></script>
  </body>
</html>
